---
title: 'Google Drive'
sidebarTitle: 'Google Drive'
description: 'Access the Google Drive API in 2 minutes 💨'
---

import ApiGotchas from "/snippets/google-shared/google-shared-gotchas.mdx"

import { StatusWidget } from "/snippets/api-down-watch/status-widget.jsx"

<StatusWidget service="google-drive" />

<Tabs>
  <Tab title="🚀 Quickstart">
    <Steps>
      <Step title="Create an integration">
        In Nango ([free signup](https://app.nango.dev)), go to [Integrations](https://app.nango.dev/dev/integrations) -> _Configure New Integration_ -> _Google Drive_.

      <Note>
        Nango has credentials you can use for testing. Activate them in the dashboard.
      </Note>

      </Step>
      <Step title="Authorize Google Drive">
        Go to [Connections](https://app.nango.dev/dev/connections) -> _Add Test Connection_ -> _Authorize_, then log in to Google Drive. Later, you'll let your users do the same directly from your app.
      </Step>
      <Step title="Call the Google Drive API">
        Let's make your first request to the Google Drive API (fetch a list of files). Replace the placeholders below with your [secret key](https://app.nango.dev/dev/environment-settings), [integration ID](https://app.nango.dev/dev/integrations), and [connection ID](https://app.nango.dev/dev/connections):
        <Tabs>
            <Tab title="cURL">

                ```bash
                curl "https://api.nango.dev/proxy/drive/v3/files?pageSize=10" \
                  -H "Authorization: Bearer <NANGO-SECRET-KEY>" \
                  -H "Provider-Config-Key: <INTEGRATION-ID>" \
                  -H "Connection-Id: <CONNECTION-ID>"
                ```

            </Tab>

            <Tab title="Node">

            Install Nango's backend SDK with `npm i @nangohq/node`. Then run:

            ```typescript
            import { Nango } from '@nangohq/node';

            const nango = new Nango({ secretKey: '<NANGO-SECRET-KEY>' });

            const res = await nango.get({
                endpoint: '/drive/v3/files',
                params: { pageSize: 10 },
                providerConfigKey: '<INTEGRATION-ID>',
                connectionId: '<CONNECTION-ID>'
            });

            console.log(res.data);
            ```
            </Tab>


        </Tabs>

        Or fetch credentials dynamically via the [Node SDK](/reference/sdks/node#get-a-connection-with-credentials) or [API](/reference/api/connection/get).

      </Step>
    </Steps>

    ✅ You're connected! Check the [Logs](https://app.nango.dev/dev/logs) tab in Nango to inspect requests.

    <Tip>
    Next step: [Embed the auth flow](/getting-started/quickstart/embed-in-your-app) in your app to let your users connect their Google Drive accounts.
    </Tip>
  </Tab>
  <Tab title="🧑‍💻 OAuth app setup">

    <Info>
      You will need to pass a security review to go live with your integration.

      [Follow our guide](/integrations/google-security-review) to get approved as fast as possible.
    </Info>

    <Steps>
      <Step title="Create a Google Cloud account">
        If you don't already have one, sign up for a [Google Cloud account](https://console.cloud.google.com/).
      </Step>
      <Step title="Create a new project">
        1. Go to the [Google Cloud Console](https://console.cloud.google.com/).
        2. Click on the project dropdown at the top left of the page.
        3. Click **New Project**.
        4. Enter a **Project Name** for your project
        5. Under **Location**, select the appropriate organization or folder where this project should belong.
        <Note>If you're not part of an organization, it will default to No organization</Note>
        6. Click **Create** and wait for the project to be created.
        7. Select it from the project dropdown.
      </Step>
      <Step title="Enable the APIs you need">
        1. Go to the [API Library](https://console.cloud.google.com/apis/library) in the Google Cloud Console.
        2. Search for **Google Drive API** and select the ones you wish to integrate with, such as **Google Drive API**, **Google Drive Activity API**, etc., then click **Enable** for each.
      </Step>
      <Step title="Configure the OAuth consent screen">
        1. Go to **APIs & Services** > **OAuth consent screen** in the Google Cloud Console.
        2. Click **Get started**.
        3. Fill in all the required fields in the **App Information** form.
        4. Click **Next**. Select the appropriate Audience:
           - **External**: For applications available to any Google user
           - **Internal**: For applications restricted to users within your Google Workspace organization
        5. Click **Next**. Fill in the **Contact Information**, these are the email addresses that Google will use to notify you about any changes to your project.
        6. Click **Next**, then check the **I agree to the Google API Services: User Data Policy** checkbox, and click **Continue**.
        7. Add the scopes your application needs. Under **Data Access**, click **Add or Remove Scopes** and select the scopes that correspond to the APIs you enabled.
        8. Under **Audience**, click **Add users** if you selected **External** user type (required for testing before verification).
      </Step>
      <Step title="Create OAuth 2.0 credentials">
        1. Go to **APIs & Services** > **Credentials** in the Google Cloud Console.
        2. Click **Create Credentials** and select **OAuth client ID**.
        3. Select **Web application** as the application type.
        4. Enter a name for your OAuth client.
        5. Under **Authorized redirect URIs**, add `https://api.nango.dev/oauth/callback`.
        6. Click **Create**.
        7. A dialog will appear with your client ID and client secret. Save these credentials securely as you'll need them when configuring your integration in Nango.
      </Step>
      <Step title="Start building your integration">
        Follow the [_Quickstart_](/getting-started/quickstart) to build your integration.
      </Step>
      <Step title="Verify your app">
       Most Google drive scopes are marked "restricted" by Google.

       A notable exception is `drive.file`, which lets you only read files the user has explicitly approved.

       You can develop your integration in test mode, but you need to pass a (security) review to go live.

       [Follow our guide](/integrations/google-security-review) to prepare and pass as quickly as possible.
      </Step>
      <Step title="Publish your app (switch from Testing to Production)">
        To move your OAuth app from testing to production:
        1. Go to **APIs & Services** > **OAuth consent screen** > **Audience**.
        2. Click **Publish App** to switch your app from testing to production.
      </Step>
    </Steps>
    ## Common Scopes

  | Scope | Description |
  | ----- | ----------- |
  | `openid` | Access to basic profile information |
  | `profile` | Access to user's basic profile information |
  | `email` | Access to user's email address |
  | `https://www.googleapis.com/auth/drive` | See, edit, create, and delete all of your Google Drive files |
  | `https://www.googleapis.com/auth/drive.apps.readonly` | View your Google Drive apps |
  | `https://www.googleapis.com/auth/drive.file` | See, edit, create, and delete only the specific Google Drive files you use with this app |
  | `https://www.googleapis.com/auth/drive.metadata` | View and manage metadata of files in your Google Drive |
  | `https://www.googleapis.com/auth/drive.readonly` | See and download all your Google Drive files |
  | `https://www.googleapis.com/auth/drive.scripts` | Modify your Google Apps Script scripts' behavior |

## Complete Integration Implementation

For a complete, production-ready implementation of Google Drive integration with Nango, check out the **[Nango Sample App](/getting-started/sample-app)**.

The sample app provides:
- Full OAuth flow implementation
- Google Drive file picker integration
- File syncing with webhooks
- File download functionality
- Complete frontend and backend code examples

You can also watch a [demo video walkthrough](https://youtu.be/oTpWlmnv7dM) or view the [GitHub repository](https://github.com/NangoHQ/sample-app).

<Tip>
The sample app is the fastest way to get started with Google Drive integration. It includes all the code you need and can be customized for your specific use case.
</Tip>

  </Tab>
  <Tab title="🔗 Useful links">
  ## Useful links
    | Topic | Links | 
    | - | - | 
    | General | [Google Cloud Console](https://console.cloud.google.com/) |
    | | [Google Cloud Documentation](https://cloud.google.com/docs) |
    | Developer | [OAuth 2.0 Documentation](https://developers.google.com/identity/protocols/oauth2) |
    | | [Using OAuth 2.0 for Web Server Applications](https://developers.google.com/identity/protocols/oauth2/web-server) |
    | | [OAuth 2.0 Scopes for Google APIs](https://developers.google.com/identity/protocols/oauth2/scopes) |
    | | [API Library](https://console.cloud.google.com/apis/library) |
    | | [OAuth Consent Screen Configuration](https://console.cloud.google.com/apis/credentials/consent) |
    | | [Credentials Management](https://console.cloud.google.com/apis/credentials) |
    | | [App Verification Requirements](https://support.google.com/cloud/answer/9110914) |
    | | [OAuth Token Expiration](https://developers.google.com/identity/protocols/oauth2#expiration) |
    | | [Google Drive API](https://developers.google.com/workspace/drive/api/reference/rest/v3) |

    <Note>Contribute useful links by [editing this page](https://github.com/nangohq/nango/tree/master/docs/integrations/all/google-drive.mdx)</Note>
  </Tab>
  <Tab title="🚨 API gotchas">
   <ApiGotchas />

    <Note>Contribute API gotchas by [editing this page](https://github.com/nangohq/nango/tree/master/docs/integrations/all/google-drive.mdx)</Note>
  </Tab>
</Tabs>

<Info>
    Questions? Join us in the [Slack community](https://nango.dev/slack).
</Info>

